/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AditPanel.java
 *
 * Created on 12.6.2010, 16:22:58
 */

package jmenu.gui;

/**
 *
 * @author Jitka
 */
public class AditPanel extends javax.swing.JPanel {

    /** Creates new form AditPanel */
    public AditPanel() {
        initComponents();

        this.aditLabel.setText(String.valueOf(this.aditSlider.getValue()));

    }

    public void setAditName(String name)
    {
        this.setBorder(javax.swing.BorderFactory.createTitledBorder(name));
    }

    public int getAditValue()
    {
        return this.aditSlider.getValue();
    }

    public void setAditValue(int v)
    {
        this.aditSlider.setValue(v);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        aditSlider = new javax.swing.JSlider();
        aditLabel = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createTitledBorder("Name"));

        aditSlider.setMaximum(50);
        aditSlider.setMinimum(-50);
        aditSlider.setPaintLabels(true);
        aditSlider.setPaintTicks(true);
        aditSlider.setSnapToTicks(true);
        aditSlider.setValue(0);
        aditSlider.setName("aditSlider"); // NOI18N
        aditSlider.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                aditSliderStateChanged(evt);
            }
        });

        aditLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        aditLabel.setText("50");
        aditLabel.setFocusable(false);
        aditLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        aditLabel.setName("aditLabel"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(aditLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(aditSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(aditLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(aditSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void aditSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_aditSliderStateChanged
        this.aditLabel.setText(String.valueOf(this.aditSlider.getValue()));
    }//GEN-LAST:event_aditSliderStateChanged


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel aditLabel;
    private javax.swing.JSlider aditSlider;
    // End of variables declaration//GEN-END:variables

}
